package cn.wolfcode.feign.feignfallback;

import cn.wolfcode.domain.Product;
import cn.wolfcode.feign.ProductFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ProductFeignFallBack implements ProductFeign {
    @Override
    public Product findByPid(Long pid) {
        log.info("当前的product-service服务挂掉了, 开启容错机制,先用默认商品顶替");
        Product product = new Product();
        product.setPname("默认商品(兜底数据)");
        product.setPid(1L);
        product.setPprice(1.00);
        return product;
    }
}
